﻿Imports DevExpress.Web

Public Class AdminConfirmBorrowed
    Inherits System.Web.UI.Page
    Dim mt As New MuonTra_BLL()
    Dim mtc As New MuonTra_DTO()
    Dim objUser As New LoginHelper("", "")
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        loadInfoDocGiaMuon()
    End Sub
    Public Sub loadInfoDocGiaMuon()
        mtc._taikhoan = Request.QueryString("taikhoan")
        DataList_XacNhanMuon.DataSource = mt.loadInfoDocGiaMuon(mtc)
        DataList_XacNhanMuon.DataBind()
    End Sub

    Protected Sub lbl_kieumuon_Init(ByVal sender As Object, ByVal e As EventArgs) Handles lbl_kieumuon.Init
        lbl_kieumuon.Text = Request.QueryString("kieumuon")
    End Sub


    Protected Sub grid_InfoSachMuon_Init(ByVal sender As Object, ByVal e As EventArgs) Handles grid_InfoSachMuon.Init
        mtc._idsach = Request.QueryString("id_sach")
        grid_InfoSachMuon.DataSource = mt.xacnhanMuon(mtc)
        grid_InfoSachMuon.DataBind()
    End Sub

    Protected Sub btn_dongy_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_dongy.Click
        Try
            mtc._idsach = Request.QueryString("id_sach")
            mtc._taikhoan = Request.QueryString("taikhoan")
            mtc._kieumuon = Request.QueryString("kieumuon")
            mtc._ngaymuon = DateTime.ParseExact(Request.QueryString("ngaymuon"), "dd/MM/yyyy", Nothing)
            mtc._ngaytra = DateTime.ParseExact(Request.QueryString("ngaytra"), "dd/MM/yyyy", Nothing)
            mtc._soluongsach = Request.QueryString("sosach")
            mtc._tennvmuon = lb_nv.Text
            mt.themMuon(mtc)
            ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('Thêm Mượn Thành Công - Tải Lại Trang');hideAllPopup();", True)
        Catch
        End Try
    End Sub

    Protected Sub lb_nv_Init(ByVal sender As Object, ByVal e As EventArgs) Handles lb_nv.Init
        objUser = TryCast(Session("sesLoginAdmin"), LoginHelper)
        lb_nv.Text = objUser.UserName
    End Sub

    Protected Sub btn_lichsumuon_Click(ByVal sender As Object, ByVal e As EventArgs)
        Try
            pc_lichsumuon.ShowOnPageLoad = True
            mtc._taikhoan = CType(DataList_XacNhanMuon.Items(0).FindControl("lbl_taikhoan"), ASPxLabel).Text
            grid_lichsumuon.DataSource = mt.loadLichSuMuonDocGia(mtc)
            grid_lichsumuon.DataBind()
        Catch
        End Try
    End Sub
End Class